<template>
  <div style="background: #16AD56;height: 100vh;">
		<van-nav-bar  title="支付" left-arrow @click-left="$utils.back($route.path)" />
		<div class="payType flex">
			<p :class="isActive === 0?'activeClass':''" @click="changePayType(0)">余额支付</p>
			<p :class="isActive === 1?'activeClass':''" @click="changePayType(1)">微信支付</p>
		</div>
		<div v-show="isActive === 0" class="br-16 mg-24">
			<div class="balance">
				<div class="usermsg">
					<div style="width: 60px;height: 60px;">
						<img-box class="classImg" :isBr50="isBr50" :img-url="userData.Images" />
					</div>
					<div class="color-white mg-22 fs-28">
						<p>{{ userData.NickName }}</p>
						<p>会员号: {{ userData.CardNumber }}</p>
					</div>
				</div>
			</div>
			<div class="paycode bg-white pd-32">
				<div class="flex flex-s-c bpay_title">
					<div class="fs-28"><img src="../../assets/images/balancePay.png" style="width:24px;"/>余额支付</div>
					<SvgIcon icon-class="right" />
				</div>
				<div class="mt-32 pd-12"><img id="barcode1" /></div>
				<div class="pd-24 pos-r flex flex-h-c">
					<img-box class="is-350" @click="setExpieTime" img-url="https://oss.hsy884.com/upload/0/2023/08/04/20230804144731484.jpg" />
				</div>
				<div class="nowtime">
					<span>{{ nowTime }} </span>
					<SvgIcon icon-class="refresh" class="fs-32 ml-10" @goPage="refresh"/> </div>
			</div>
		</div>
		<div v-show="isActive === 1" class="pd-24 bg-white br-32 mg-24 pb-170">
			<div class="pd-36 mt-66"><img id="barcode1" /></div>
			<div class="pd-24 pos-r flex flex-h-c">
				<img-box class="is-350" @click="setExpieTime" img-url="https://oss.hsy884.com/upload/0/2023/08/04/20230804144731484.jpg" />
			</div>
		</div>
		
	</div>
</template>
<script>
import SvgIcon from 'components/SvgIcon'
import imgBox from 'components/imgBox'
import JsBarcode from 'jsbarcode'
import { GetNowTime } from 'api/activity'
import { GetUserDetail } from 'api/member'
export default {
	components: {
		SvgIcon,imgBox,JsBarcode
  },
	data() {
		return {
			marIdCode: '12b34v56',
			isActive: 0,
			nowTime: '',
			userData:{},
			isBr50: true,
		}
	},
	created() {
		this.GetUserDetail()
		this.GetNowTime()
	},
	mounted() {
		this.barCode()
  },
	methods: {
		//会员详情信息
		GetUserDetail(){
      GetUserDetail().then(res => {
        if (res) {
          this.userData = res.Data
        }
      })
    },
		GetNowTime(){
			GetNowTime().then(rsp => {
				if(rsp.State==1){
					this.nowTime = rsp.Data
				}
			})
		},

		barCode(){
			let barCode1 = this.marIdCode;
			JsBarcode("#barcode1",barCode1,{
					format:"CODE128",//条形码的格式
					width:5,//线宽
					height:150,//条码高度
					lineColor:"#333",//线条颜色
					displayValue:false,//是否显示文字
					margin: 1//设置条形码周围的空白区域
				})
		},

		setExpieTime(){
			
			//访问接口 获取二维码
		},
		
		changePayType(type){
			this.isActive = type
			if(type === 0){
				this.GetNowTime()
			}
		},
		refresh(){
			this.GetNowTime()
		}
	}
}
</script>
<style lang="scss" scoped>
body{
	background: $lightBlue !important;
}
.validTime{
	display: flex;
	justify-content: space-between;
	border-bottom: 1px solid #f5f5f5;
	padding-bottom: 24px;
	font-size: 28px;
}
/deep/.van-cell{
	padding: 2px 12px;
	width: 120px;
	border: 1px solid #333;
	margin-right: 10px;
}
.seticon{
	position: absolute;
	right: 0;
	bottom: 12px;
}
.w-200{
	width: 200px;
}
.payWay{
	border-top: 1px solid #f5f5f5;
	padding: 24px 24px 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.payWay img{
	width: 48px;
	height: 48px;
}
.mt-30 img{
	width: 48px;
	height: 48px;
}
.choose{
	margin-top: 30px;
	display: flex;
  justify-content: space-between;
}
.choose img{
	width: 48px;
	height: 48px;
}
.paylist{
	border-radius: 12px 12px 0 0;
}
.payType{
	width: 362px;
	height: 64px;
	line-height: 64px;
	background: rgba(255,255,255,.6);
	border-radius: 32px;
	margin: 24px auto 94px;
	p{
		width: 180px;
		text-align: center;
		font-size: 28px;
		color: #666666;
	}
	.activeClass{
		background: #fff;
		border-radius: 32px;
		color: rgba(0,0,0,0.85);
	}
}
.balance{
	width: 702px;
	height: 500px;
	background: #DADADA;
	box-shadow: 0px -4px 20px 0px rgba(0,0,0,0.1);
	border-radius: 40px 40px 0px 0px;
	position: relative;
	z-index: 11;
}
.usermsg{
	width: 638px;
	height: 222px;
	background: #3E3E3E;
	border-radius: 32px 32px 0px 0px;
	position: absolute;
	top: -46px;
	left: 32px;
	padding: 26px 32px;
	display: flex;
	img{
		border: 1px solid #fff;
		border-radius: 50%;
		width: 100%;
	}
}
.paycode{
	width: 702px;
	height: 864px;
	background: #FFFFFF;
	box-shadow: 0px -4px 20px 0px rgba(0,0,0,0.1);
	border-radius: 0px 0px 32px 32px;
	position: relative;
	z-index: 111;
	margin-top: -388px;
}
.bpay_title{
	padding-bottom: 32px;
	border-bottom: 1px dashed #eaeaea;
}
.nowtime{
	width: 336px;
	height: 54px;
	line-height: 54px;
	background: #F6F6F6;
	border-radius: 28px;
	margin: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #666;
}
.mt-66{
	margin-top: 66px;
}
</style>
